import java.util.ArrayList;
import java.util.HashMap;

public class Java1 {
    public static void main(String[] args) {
        ArrayList<String> arraylist = new ArrayList<>();
        System.out.println("集合的长度：" + arraylist.size());
        arraylist.add("123");
        arraylist.add("456");
        arraylist.add("789");
        arraylist.add("123");
        arraylist.add("456");
        arraylist.add("789");
        System.out.println("集合的长度：" + arraylist.size());
        //arraylist的删除
        arraylist.remove("123");
        //arraylist.remove(3);
        for (int i = 0; i < arraylist.size(); i++) {
            System.out.println(arraylist.get(i));
        }
        HashMap<String,String> hashMap=new HashMap<>();
        //增加
        hashMap.put("Key1","Value1");
        hashMap.put("Key2","Value2");
        hashMap.put("Key3","Value");
        hashMap.put("Key4","Value4");
        //删除
        hashMap.remove("Key3");
        //修改
        hashMap.put("Key4","这是被修改过的Key4");
        //遍历
        System.out.println(hashMap.get("Key4"));
        for (String key:hashMap.keySet()){
            System.out.println("Key是："+key+" | Value是："+hashMap.get(key));
        }
    }
}
